
var case2 = function () {
    return new Promise(function (allResolve) {
        new Promise(function (resolve) {
            console.log("1-1");
            setTimeout(function () {
                resolve();
            }, 1000);
        }).then(function () {
            return new Promise(function (resolve) {
                console.log("1-2");
                setTimeout(function () {
                    resolve();
                }, 1000);
            });
        }).then(function () {
            return new Promise(function (resolve) {
                console.log("1-3");
                setTimeout(function () {
                    resolve();
                }, 1000);
            });
        }).then(function () {
            return new Promise(function (resolve) {
                console.log("1-4");
                setTimeout(function () {
                    resolve();
                }, 1000);
            });
        }).then(function () {
            return new Promise(function (resolve) {
                console.log("1-5");
                setTimeout(function () {
                    resolve();
                }, 1000);
            });
        }).then(function () {
            return new Promise(function (resolve) {
                console.log("1-6");
                setTimeout(function () {
                    allResolve();
                }, 1000);
            });
        });
    });
}
console.log("2-1");
case2().then(function () {
    console.log("x-x");
});
console.log("2-2");